/**
 * @author temsa
 */
(function() {
    var hasJustConsoleLog = typeof console != "undefined" && console && console.log && !$exist(console.debug);

    if (typeof console == "undefined") {
        console = {
            log :_,
            debug :_,
            warn :_,
            error :_,
            fatal :_
        };
    }

    /**
 * Defines a logger designed to work with firebug
 * 
 * @namespace Archetype.Loggers.FirebugLogger
 */
    if (hasJustConsoleLog) {
        try {
            Archetype.Loggers.FirebugLogger = {
                initialize : function() {
                },
                log : console.log.bind(console),
                debug : console.log.bind(console),
                warn : console.log.bind(console),
                error : console.log.bind(console),
                fatal : console.log.bind(console)
            }
        } catch (e) {
            Archetype.Loggers.FirebugLogger = {
                initialize : function() {
                },
                log : console.log,
                debug : console.log,
                warn : console.log,
                error : console.log,
                fatal : console.log
            }
        }

    } else {
        Archetype.Loggers.FirebugLogger = {
            /**
		 * Logs callers arguments to the lvl log level in the firebug
		 * @param lvl {String} console log level 
		 */
            _log: function(lvl) {
                return console[lvl].apply(console, Archetype.Loggers.AbstractLogger._getArgs());
            },
            initialize : function() {
            },
            log : function() {
                return console.log.apply(console, Archetype.Loggers.AbstractLogger._getArgs());
            },
            debug : function() {
                return console.log.apply(console, Archetype.Loggers.AbstractLogger._getArgs());
            },
            warn : function() {
                return console.warn.apply(console, Archetype.Loggers.AbstractLogger._getArgs());
            },
            error : function() {
                if(console.trace)
                    console.trace();
                return console.error.apply(console, Archetype.Loggers.AbstractLogger._getArgs());
            },
            fatal : function() {
                if(console.trace)
                    console.trace();
                return console.error.apply(console, Archetype.Loggers.AbstractLogger._getArgs());
            }
        }
    }
})();
